//
//  ChooseCarToShareView.m
//  New_Runway
//
//  Created by 张记 on 2018/5/28.
//  Copyright © 2018年 NelsonJ. All rights reserved.
//

#import "ChooseCarToShareView.h"

@interface ChooseCarToShareView ()

@property (weak, nonatomic) IBOutlet UIButton *allChoose;

@end

@implementation ChooseCarToShareView

-(void)awakeFromNib{
    [super awakeFromNib];
    self.backgroundColor = UIColorHex(0xf6f6f6);
    self.chooseCarB.layer.masksToBounds = YES;
    self.chooseCarB.layer.cornerRadius = 5;
    self.chooseCarB.layer.borderColor = MAIN_NAV_COLOR().CGColor;
    self.chooseCarB.layer.borderWidth = 0.5f;
    [self.chooseCarB setTitle:@"选车分享" forState:UIControlStateNormal];
    [self.chooseCarB setTitleColor:MAIN_COLOR() forState:UIControlStateNormal];
    [self.chooseCarB setTitle:@"取消分享" forState:UIControlStateSelected];
    [self.chooseCarB setTitleColor:MAIN_NAV_COLOR() forState:UIControlStateSelected];
    self.allChoose.hidden = YES;
    [self.allChoose setImage:[UIImage imageNamed:@"share_selected_no"] forState:UIControlStateNormal];
    
}
- (IBAction)ChooseAllCarToShare:(UIButton *)sender {
    sender.selected = !sender.selected;
    self.ChooseAllCarBlock(sender.selected);
    if (sender.selected == YES) {
        [self.allChoose setImage:[UIImage imageNamed:@"share_selected_yes"] forState:UIControlStateNormal];
    }else{
        [self.allChoose setImage:[UIImage imageNamed:@"share_selected_no"] forState:UIControlStateNormal];
    }
}
- (IBAction)chooseCarToShare:(UIButton *)sender {
    sender.selected = !sender.selected;
    if (sender.selected == YES) {
        sender.backgroundColor = UIColorHex(0xf6f6f6);
//        self.allChoose.hidden = NO;

    }else{
        sender.backgroundColor = MAIN_NAV_COLOR();
//        se lf.allChoose.hidden = YES;

    }
    self.ChooseShareBlock(sender.selected);
    
}

@end
